<template>
  <div class="modal-content" :style="'z-index:'+(level+1)">
    <div class="modal-block" :style="'width:'+width+';height:'+height+';z-index:'+(level+2)">
      <div class="modal-header">
        <div class="line"></div>
        <div class="title">{{title}}</div>
        <img @click="close" class="close" src="@/assets/Quick/close.png">
      </div>
      <div class="modal">
        <slot></slot>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Modal",
  props:{
    width:{
      type:String,
      default:'1400px'
    },
    height:{
      type:String,
      default:'700px'
    },
    title:{
      type:String,
      default:''
    },
    level:{
      type:Number,
      default:1
    }
  },
  emits:['closeModal'],
  methods:{
    close(){
      this.$emit('closeModal')
    }
  }
}
</script>

<style scoped lang="scss">
.modal-content{
  position: fixed;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.7);
  top: 0;
  left: 0;
  z-index: 2;
  .modal-block{
    z-index: 3;
    position: fixed;
    transform: translate(-50%,-50%);
    top: 50%;
    left: 50%;
    overflow:hidden;
    padding: 20px;
    border-radius: 5px;
    border: 1px solid #1d5363;
    background: #fff;
    .modal-header{
      width: 100%;
      height: 25px;
      display:flex;
      align-items: center;
      margin-bottom: 10px;
      .line{
        width: 7px;
        height: 20px;
        border-radius: 16px;
        background: #000000;
        margin-right: 8px;
        flex-grow: 0;
      }
      .title{
        color: #000000;
        flex-grow: 1;
      }
      .close{
        width: 25px;
        height: 25px;
        cursor: pointer;
      }
    }
    .modal{
      width: 100%;
      height: calc(100% - 35px);
      overflow-y: auto;
    }
  }
}
</style>
